package com.sketch.controller;

import com.sketch.commom.PageResult;
import com.sketch.commom.Result;
import com.sketch.entity.dto.DeleteDTO;
import com.sketch.entity.dto.PayConfigDTO;
import com.sketch.entity.dto.VipPriceDTO;
import com.sketch.service.PayConfigService;
import com.sketch.service.VipPriceService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
@RestController
@Api(tags = "支付配置管理 API")
@RequestMapping(value = "/api/payConfig")
public class PayConfigController {
    @Resource
    private PayConfigService payConfigService;
    /**
     * 新增或更新
     */
    @PostMapping("/addOrUpdate")
    @ApiOperation("新增或更新")
    public Result addOrUpdate(@RequestBody PayConfigDTO payConfigDTO) {
        return payConfigService.addOrUpdate(payConfigDTO);
    }

    /**
     * 列表
     */
    @GetMapping("/list")
    @ApiOperation("列表")
    public Result<PageResult<PayConfigDTO>> list(@RequestParam(value = "page", defaultValue = "1", required = false) Integer page,
                                                @RequestParam(value = "size", defaultValue = "20", required = false) Integer size) {
        return payConfigService.list(page, size);
    }

    /**
     * 详情
     */
    @GetMapping("/detail")
    @ApiOperation("剧场详情")
    public Result<PayConfigDTO> detail(@ApiParam(value = "id") @RequestParam Long id){
        return payConfigService.detail(id);
    }

    /**
     * 删除
     */
    @GetMapping("/delete")
    @ApiOperation("删除")
    public Result delete(@RequestBody DeleteDTO deleteDTO) {
        return payConfigService.delete(deleteDTO.getId());
    }

}
